VERSION 5.00
Begin VB.Form frmClose 
   BackColor       =   &H00FFFFFF&
   Caption         =   "End of Day"
   ClientHeight    =   5310
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   Icon            =   "frmClose.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   5310
   ScaleWidth      =   4680
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdCancel 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   315
      Left            =   2640
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   4860
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.CommandButton cmdContinue 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "Continue"
      Height          =   315
      Left            =   840
      MaskColor       =   &H00E0E0E0&
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   4860
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "System Close"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   4575
      Left            =   240
      TabIndex        =   8
      Top             =   120
      Width           =   4215
      Begin VB.ListBox lstCloseStatus 
         Height          =   1425
         Left            =   240
         TabIndex        =   13
         Top             =   2940
         Width           =   3675
      End
      Begin VB.ComboBox f498 
         Height          =   315
         Left            =   1320
         TabIndex        =   2
         Top             =   1080
         Width           =   1215
      End
      Begin VB.ComboBox cboName2 
         Height          =   315
         Left            =   1320
         TabIndex        =   0
         Top             =   360
         Width           =   2295
      End
      Begin VB.ComboBox f10 
         Height          =   315
         Left            =   1320
         TabIndex        =   1
         Top             =   720
         Width           =   2295
      End
      Begin VB.Frame Frame2 
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         Caption         =   "Frame1"
         Height          =   1095
         Left            =   720
         TabIndex        =   9
         Top             =   1560
         Width           =   2775
         Begin VB.OptionButton optClose 
            BackColor       =   &H00FFFFFF&
            Caption         =   "Close FedEx Express"
            Height          =   255
            Index           =   1
            Left            =   240
            TabIndex        =   4
            Top             =   360
            Width           =   1935
         End
         Begin VB.OptionButton optClose 
            BackColor       =   &H00FFFFFF&
            Caption         =   "Close FedEx Ground"
            Height          =   255
            Index           =   2
            Left            =   240
            TabIndex        =   5
            Top             =   720
            Width           =   1935
         End
         Begin VB.OptionButton optClose 
            BackColor       =   &H00FFFFFF&
            Caption         =   "Close Express and Ground"
            Height          =   315
            Index           =   0
            Left            =   240
            TabIndex        =   3
            Top             =   0
            Width           =   2175
         End
      End
      Begin VB.Label Label3 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Close Status:"
         Height          =   255
         Left            =   240
         TabIndex        =   14
         Top             =   2700
         Width           =   1035
      End
      Begin VB.Label Label2 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Sys#:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   360
         TabIndex        =   12
         Top             =   1140
         Width           =   855
      End
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Name:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   540
         TabIndex        =   11
         Top             =   420
         Width           =   675
      End
      Begin VB.Label Label8 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Acct#:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   360
         TabIndex        =   10
         Top             =   780
         Width           =   855
      End
   End
End
Attribute VB_Name = "frmClose"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

'---------------------------------------------------------------------------------------
' Procedure : cboName2_Click(), f10_Click(),f498_Change()
' DateTime  : 7/26/2004
' Purpose   : These 3 Subs synchronize the account name, number and meter# so that no matter
'             which one is selected the other 2 are updated.
'---------------------------------------------------------------------------------------
'
Private Sub cboName2_Click()
    f10.ListIndex = cboName2.ListIndex
    f498.ListIndex = cboName2.ListIndex
End Sub

Private Sub f10_Click()
    cboName2.ListIndex = f10.ListIndex
    f498.ListIndex = f10.ListIndex
End Sub
Private Sub f498_Click()
    cboName2.ListIndex = f498.ListIndex
    f10.ListIndex = f498.ListIndex
End Sub
'---------------------------------------------------------------------------------------
' Procedure : cmdCancel_Click()
' DateTime  : 2/18/2004
' Purpose   : Cancel button hides form
'---------------------------------------------------------------------------------------
'
Private Sub cmdCancel_Click()
    Call frmShip.EnableButtons
    Me.Hide
    frmShip.SetFocus
End Sub
'---------------------------------------------------------------------------------------
' Procedure : cmdContinue_Click()
' DateTime  : 9/9/2004
' Purpose   : When Continue button is clicked, Call CloseFXRS passing close type.
'---------------------------------------------------------------------------------------
'
Private Sub cmdContinue_Click()
    
    Dim strMessage As String
    
    'CIC defined routine to run before system close.
    Call BeforeClose
    
    'Check for multiple servers
    If frmSetup.cboFXRSIP.ListCount >= 2 Then
        strMessage = "There are multiple servers configured in your setup." & vbCrLf
        strMessage = strMessage & "If shipping has been performed on any backup server " & vbCrLf
        strMessage = strMessage & "those servers must be closed as well."
    
        MsgBox strMessage, vbInformation, "Multiple Servers"
    End If
    
    Call CloseMeters
    
    cmdCancel.Caption = "Done"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : CloseMeters()
' DateTime  : 11/11/2004
' Purpose   : Send a Version Capture transaction then close meter(s) selected and carrier(s).
'---------------------------------------------------------------------------------------
'
Private Sub CloseMeters()
    Dim rsAccts As New ADODB.Recordset
    Dim strQuery As String
    
    If Not g_blnNextClose Then
    
        'Added Version Capture Call 11/11/04
        Call SendData(BuildVersionCaptureTrans)
    
        Do Until g_blnNextClose
            DoEvents
            Call Pause(0.1)
        Loop
    End If
    
    If f10 = "ALL" Then
        ' 2007-04-03, JFW, Unique meters only
        strQuery = "SELECT f498 FROM Meters group by f498 order by 1"
        rsAccts.Open strQuery, g_connFSMSClient, adOpenStatic, adLockOptimistic
        
        Do Until rsAccts.EOF
            
            g_blnNextClose = False
            
            If optClose(0) Then
                Call SendData(BuildCloseTrans(rsAccts!f498))
            ElseIf optClose(1) Then
                Call SendData(BuildCloseTrans(rsAccts!f498, "FDXE"))
            ElseIf optClose(2) Then
                Call SendData(BuildCloseTrans(rsAccts!f498, "FDXG"))
            End If
            lstCloseStatus.AddItem "Closing Meter#: " & rsAccts!f498
            
            Do Until g_blnNextClose
                DoEvents
                Call Pause(0.1)
            Loop
            
            rsAccts.MoveNext
        Loop
    
    Else
        If optClose(0) Then
            Call SendData(BuildCloseTrans(f498))
        ElseIf optClose(1) Then
            Call SendData(BuildCloseTrans(f498, "FDXE"))
        ElseIf optClose(2) Then
            Call SendData(BuildCloseTrans(f498, "FDXG"))
        End If
        lstCloseStatus.AddItem "Closing Meter#: " & f498
    End If

End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_Activate()
' DateTime  : 7/26/2004
' Purpose   : Sets Cancel button caption back to Cancel
'---------------------------------------------------------------------------------------
'
Private Sub Form_Activate()
    cmdCancel.Caption = "Cancel"
    cboName2.SetFocus
End Sub

Private Sub Form_Deactivate()
    lstCloseStatus.Clear
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_KeyDown()
' DateTime  : 2/17/2005
' Purpose   : Enter key pressed sends a TAB to move to next field
'---------------------------------------------------------------------------------------
'
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If Not TypeOf Me.ActiveControl Is CommandButton Then
        If Shift = 0 And KeyCode = 13 Then
            SendKeys "{TAB}"
        End If
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_Load()
' DateTime  : 2/18/2004
' Purpose   : Set Close Express and Ground as default.
'---------------------------------------------------------------------------------------
'
Private Sub Form_Load()
    With frmSetup
        Call LoadAcctNumCombo(f10, .f10)
        Call LoadNameCombo(cboName2, .cboName)
        Call LoadMetersCombo(f498, .f498)
        If f10.ListCount > 1 Then
            cboName2.AddItem "ALL", 0
            f498.AddItem "ALL", 0
            f10.AddItem "ALL", 0
        End If
    End With
    optClose(0).Value = True
End Sub
